{extend name="public:base" /}
{block name="body"}
<div class="row">
    <div class="col-md-8">
        <div class="page-header">
            <h2>用户登录</h2>
        </div>
        <form class="form-horizontal" method="post" id="login">
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">邮箱</label>
                <div class="col-sm-10">
                    <input type="email" name="email" class="form-control" id="inputEmail3" placeholder="邮箱">
                </div>
            </div>
            <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
                <div class="col-sm-10">
                    <input type="password" name="password" class="form-control" id="inputPassword3" placeholder="Password">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="button" class="btn btn-primary" id="register">登录</button>
                </div>
            </div>
        </form>
    </div>
{/block}
{block name="js"}
<script>
    $(function () {
        $('#register').on('click', function () {
            $.ajax({
                type : 'post',
                url : "{:url('loginCheck')}",
                data : $('#login').serialize(),
                dataType : 'json',
                success : function (res) {
                    alert(res.msg)
                    if (res.status == 1){
                        window.location.href = "{:url('index/index/index')}";
                    }
                }

            });
        })
    })
</script>
{/block}